/**
 * aaa.java
 * com.game.websocket
 * Copyright (c) 2016, 北京聚智未来科技有限公司版权所有.
 */

package com.game.websocket;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

/**
 * TODO Servlet执行初始化,主要是定义一个List,用户存放WebSocket对象:
 * 
 * @author gyp
 * @Date 2016年12月16日
 * @Time 下午6:01:04
 */
public class InitServlet extends HttpServlet {

	private static final long serialVersionUID = -1936532122758235837L;

	private static List<MyWebSocket> socketList;

	public void init(ServletConfig config) throws ServletException {
		InitServlet.socketList = new ArrayList<MyWebSocket>();
		super.init(config);
		System.out
				.println("==================================Server start=========================================");
	}

	public static synchronized List<MyWebSocket> getSocketList() {

		System.out.println(socketList.size()
				+ "**********************************************");
		return InitServlet.socketList;
	}

}
